#include "widget.h"
#include "ui_widget.h"
#include <windows.h>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->pushButton_2->hide();
    connect(ui->pushButton,&QPushButton::clicked,this,&Widget::handleclick);
    connect(ui->pushButton_2,&QPushButton::clicked,this,&Widget::handleclick2);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleclick()
{
    if(ui->label->text().toInt()<10)
    {
        int num = ui->label->text().toInt();
        if(num < 10) ++num;
        ui->label->setText(QString::number(num));
        if(num == 10)
        {
            ui->pushButton->hide();
            ui->pushButton_2->show();
        }

    }
}

void Widget::handleclick2()
{
    ui->label->setText(QString::number(0));
    ui->pushButton->show();
    ui->pushButton_2->hide();
}

